/**
 *
 * @param  {string} baseUrl
 * @param  {Array} urlMap 现有接口链接
 * @param  {Array} letMap  默认权限
 */

const baseUrl = "/manager/"

//接口访问权限对应变量
let urlMap = {
  getUserList: baseUrl + 'users/list',
  getUnusualInfo: baseUrl + 'customerService/abnormalList',
  thousandPlanStatus: baseUrl + 'customerService/thousandPlanStatus/update',
  customerStatus: baseUrl + 'customerService/customerStatus/update',
  fetchGetEquipmentManageData: baseUrl + 'equipmentManage/list',
  fetchEquipmentUnbindData: baseUrl + 'equipmentManage/equipment/unbind',
  fetchGetEquipmentHistoryData: baseUrl + 'equipmentManage/equipment/findHistory',
  fetchGetEquipmentSortData: baseUrl + 'equipmentManage/equipment/sort',
  fetchGetFeedbackData: baseUrl + 'customerService/feedBack/findAll',
  fetchHistoryFeedbackData: baseUrl + 'customerService/feedBack/findHistory',
  fetchReplyFeedbackData: baseUrl + 'customerService/feedBackReply/save',
  fetchGetSMSTemplate: baseUrl + 'templateManager/findAllMessageTemplate',
  fetchSendMessageView: baseUrl + 'informationPush/alidayuMessage/findDetail',
  fetchSendSMS: baseUrl + 'informationPush/sendMessage',
  fetchNewSMSTemplate: baseUrl + 'templateManager/saveMessageTemplate',
  fetchSearchSMSTemplate: baseUrl + 'templateManager/searchMessageTemplates',
  fetchDeleteSMSTemplate: baseUrl + 'templateManager/deleteMessageTemplates',
  fetchAlidayuMessageSendData: baseUrl + 'informationPush/alidayuMessageSend/findAll',
  fetchYouMengTemplateData: baseUrl + 'templateManager/findAllPushTemplate',
  fetchNewYouMengTemplateData: baseUrl + 'templateManager/savePushTemplate',
  fetchDeleteYouMengTemplateData: baseUrl + 'templateManager/deletePushTemplate',
  fetchSearchYouMengTemplateData: baseUrl + 'templateManager/deletePushTemplate',
  fetchYouMengViewData: baseUrl + 'informationPush/youmengPush/findDetail',
  fetchYouMengPushHistoryData: baseUrl + 'informationPush/youMengPush/findAll',
  fetchYouMengPushData: baseUrl + 'informationPush/youmengPush',
  fetchMessageTypeData: baseUrl + 'templateManager/findAllMessageType',
  fetchAppMessagePushHistoryData: baseUrl + 'informationPush/AppMessagePush/findAll',
  fetchAppMessagePushData: baseUrl + 'informationPush/AppMessagePush',
  fetchAppMessageViewData: baseUrl + 'informationPush/AppMessagePush/findDetail',
  fetchUploadImg: baseUrl + 'users/ultrasound/upload',
  fetchDownloadImg: baseUrl + 'users/record/ultrasound',
  fetchHomeChart: baseUrl + 'report/index',
  customUserListCurve: baseUrl + 'users/list/curve',
  customUserListCurveDownLoad: baseUrl + 'users/excel'
}


//变量与接口名对应
const letMap = {
  getUserList: false,
  getUnusualInfo: false,
  thousandPlanStatus: false,
  customerStatus: false,
  fetchGetEquipmentManageData: false,
  fetchEquipmentUnbindData: false,
  fetchGetEquipmentHistoryData: false,
  fetchGetEquipmentSortData: false,
  fetchGetFeedbackData: false,
  fetchHistoryFeedbackData: false,
  fetchReplyFeedbackData: false,
  fetchGetSMSTemplate: false,
  fetchSendMessageView: false,
  fetchSendSMS: false,
  fetchNewSMSTemplate: false,
  fetchSearchSMSTemplate: false,
  fetchDeleteSMSTemplate: false,
  fetchAlidayuMessageSendData: false,
  fetchYouMengTemplateData: false,
  fetchNewYouMengTemplateData: false,
  fetchDeleteYouMengTemplateData: false,
  fetchSearchYouMengTemplateData: false,
  fetchYouMengViewData: false,
  fetchYouMengPushHistoryData: false,
  fetchYouMengPushData: false,
  fetchMessageTypeData: false,
  fetchAppMessagePushHistoryData: false,
  fetchAppMessagePushData: false,
  fetchAppMessageViewData: false,
  fetchUploadImg: false,
  fetchDownloadImg: false,
  fetchHomeChart: false,
  customUserListCurve: false,
  customUserListCurveDownLoad: false
}


const SetAccessRule = (urlList, urlMap, letMap) => {
  for (let item in urlList) {
    SetMapRelationTrue(urlList[item].url, urlMap, letMap)
  }
  return letMap
}


const SetMapRelationTrue = (url, urlMap, letMap) => {
  for (let item in urlMap) {
    if (url == urlMap[item]) {
      letMap[item] = true
    }
  }

}


export {
  letMap,
  urlMap,
  SetAccessRule,
}
